package part1;

public class TeacherDaoProxy implements ITeacherDao {
    private ITeacherDao target; // 要代理的目标对象，通过接口关联

    public TeacherDaoProxy(ITeacherDao target) {
        this.target = target;
    }

    public ITeacherDao getTarget() {
        return target;
    }

    public void setTarget(ITeacherDao target) {
        this.target = target;
    }

    @Override
    public void teach() { // 在这里可以实现很多额外的方法。增加它的功能
        System.out.println("代理开始");
        target.teach();
        System.out.println("代理结束");
    }
}
